 
import os

label_dir = r"D:\KLG\FINAL\code\testImg\label"
class_count = {}

for file in os.listdir(label_dir):
    if file == "classes.txt":
        continue
    with open(os.path.join(label_dir, file), "r") as f:
        for line in f:
            class_name = line.split()[0]
            if class_name not in class_count:
                class_count[class_name] = 1
            else:
                class_count[class_name] += 1

print("Class distribution:")
for class_name, count in class_count.items():
    print(f"{class_name}: {count}")






